package main

import (
	"context"
	"fmt"

	"github.com/tendermint/tendermint/my_test/config"
	"github.com/tendermint/tendermint/rpc/client/http"
)

var (
	cli          *http.HTTP
	targetHeight int64 = 50
	err          error
)

func init() {
	var err error
	cli, err = http.New(config.DefaultIPAndPort, "/websocket")
	if err != nil {
		panic(err)
	}
}

func main() {
	cli, err = http.New(config.DefaultIPAndPort, "/websocket")
	if err != nil {
		panic(err)
	}

	res, err := cli.Block(context.TODO(), &targetHeight)
	if err != nil {
		panic(err)
	}

	fmt.Println(res)

	for _, tx := range res.Block.Txs {
		fmt.Println(string(tx))
	}
}
